#pragma once

#define _CRTDBG_MAP_ALLOC
#include<stdlib.h>
#include<crtdbg.h>

#ifdef _DEBUG
#  define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
#endif

inline void EnableMemLeakCheck(){
	_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
}


#include <tchar.h>
#include <assert.h>
#include <stdio.h>
#include <memory.h>
#include <tchar.h>
#include <limits.h>
#include <time.h>
#include <stdarg.h>

#define SAFE_DELETE(p) if(p) {delete p;p = NULL;}
#define SAFE_DELETE_ARRAY(p) if(p) {delete[] p; p = NULL;}

#ifndef null
#  define null 0
#endif

#define CAT CAT  // this place change the namespace'name if you like
#define BEGIN_NAME_SPACE namespace CAT {
#define END_NAME_SPACE   }

extern long beginTime;
inline void StartTimer()
{
	beginTime = clock();
}
inline long EndTimer()
{
	return clock() - beginTime;
}
